package com.java.test.rest.http.async;

import java.util.Map;

import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.ResponseEntity;
import org.springframework.util.concurrent.ListenableFuture;

/**
 * 异步调用模板接口
 *
 * @author http://blog.csdn.net/pistolove/article/details/51428562
 *
 * @date 2017年11月25日下午7:06:07
 */
public interface Templete {

    /**
     * 异步调用模板接口
     * 
     * @param baserequest
     * @param responseType
     * @return
     * @throws Exception
     */
    <T> ListenableFuture<ResponseEntity<T>> getAsyncForObject(BaseRequest baserequest,
            Class<T> responseType) throws Exception;

    /**
     * 异步调用模板接口
     * 
     * @param baserequest
     * @param responseType
     * @return
     * @throws Exception
     */
    <T> ListenableFuture<ResponseEntity<T>> getAsyncForObject(BaseRequest baserequest,
            ParameterizedTypeReference<T> responseType) throws Exception;

    /**
     * 异步调用模板接口
     * 
     * @param baserequest
     * @param responseType
     * @param uriVariables
     * @return
     * @throws Exception
     */
    <T> ListenableFuture<ResponseEntity<T>> getAsyncForObject(BaseRequest baserequest,
            Class<T> responseType, Map<String, ?> uriVariables) throws Exception;

    /**
     * 异步调用模板接口
     * 
     * @param baserequest
     * @param responseType
     * @param uriVariables
     * @return
     * @throws Exception
     */
    <T> ListenableFuture<ResponseEntity<T>> getAsyncForObject(BaseRequest baserequest,
            ParameterizedTypeReference<T> responseType, Map<String, ?> uriVariables)
            throws Exception;
}
